package demo19;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * @author Huangjin
 * @version 1.0
 * describe:
 * @date 2023/3/9 18:26
 */
public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("pw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);
        Scanner sc = new Scanner(System.in);
        System.out.println("请开始输入内容，单独输入exit退出");
        while (true){
            String line = sc.nextLine();
            if ("exit".equals(line)){
                break;
            }
            pw.print(line);
        }
    }
}
